#include "printing.h"
#include "encoding.h"
#include <Windows.h>
#include <cstdio>

void dbgprint(const char *format, ...) {
  char format_buf[0x1000];
  va_list valist;
  va_start(valist, format);
  vsprintf_s(format_buf, format, valist);
  OutputDebugStringA(format_buf);
  printf("%s", format_buf);
  va_end(valist);
}

void dbgprint(const wchar_t *format, ...) {
  wchar_t format_buf[0x0980];
  va_list valist;
  va_start(valist, format);
  vswprintf_s(format_buf, format, valist);
  OutputDebugStringW(format_buf);
  printf("%S", format_buf);
  va_end(valist);
}

void dbgprintu8(const char *format, ...) {
  char format_buf[0x1000];
  va_list valist;
  va_start(valist, format);
  vsprintf_s(format_buf, format, valist);
  OutputDebugStringA(u8toa(format_buf).c_str());
  printf("%s", u8toa(format_buf).c_str());
  va_end(valist);
}
